package com.pro.springbootshop.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pro.springbootshop.entity.Seller;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.mapstruct.Mapper;

import java.util.List;

@Mapper
public interface SellerMapper extends BaseMapper<Seller> {
    @Select("select * from seller where seller_id=#{sellerId} and seller_pw=#{sellerPw}")
    Seller sellerLogin(@Param("sellerId") String sellerId, @Param("sellerPw") String sellerPw);
    @Select("select * from seller where seller_id=#{sellerId}")
    Seller sellerSearch(@Param("sellerId") String sellerId);
    @Update("update seller set seller_pw = #{sellerPw} where seller_id=#{sellerId}")
    void updatePassword(@Param("sellerPw") String sellerPw,@Param("sellerId") String sellerId);
    @Select("select * from seller where seller_id!='admin' limit #{pageNo},#{limit}")
    List<Seller> adminGetSeller(@Param("pageNo") int pageNo,@Param("limit")  int limit);
    @Delete("delete from seller where seller_id=#{sellerId}")
    int adminDeleteSeller(@Param("sellerId") String sellerId);
}
